﻿
using System.Configuration;

namespace BookExchange.Configuration
{
    public class AppConfiguration
    {
        private static AppConfiguration instance;

        public static AppConfiguration Instance
        {
            get
            {
                return instance ?? new AppConfiguration();
            }
        }

        private AppConfiguration()
        {
            this.ODataSerivceUrl = ConfigurationManager.AppSettings["OdataServiceUrl"];
            
            this.DefaultSessionTimeout = 30; //20 minutes
            this.MaximumSessionTimeout = 43200; //1 months           
            this.DateFormat = "dd/MM/yyyy";
            this.DateTimeFormat = "dd/MM/yyyy HH:mm:ss";
            this.WebServiceTimeout = 60;
            //Item per page's used for all web pages: default.aspx, search.aspx.... 
            this.MaxItemPerPage = int.Parse(ConfigurationManager.AppSettings["MaxItemPerPage"]);
            //This's used for private web page: searchall.aspx;
            this.MaxItemPerPageSearchAll = int.Parse(ConfigurationManager.AppSettings["MaxItemPerPageSearchAll"]);
            this.CurrencyFormat = "#,##0.## đ";
            this.DecimalFormat = "#,##0.##";
            this.IntegerFormat = "#,##0";
            this.ItemPerSlideShow = 4;
            this.AmountOfSlideShow = 4;
            this.ImageFolder = "ImgFiles";
        }

        public string ODataSerivceUrl { get; private set; }
        public int DefaultSessionTimeout { get; set; }
        public int MaximumSessionTimeout { get; set; }
        public string DateFormat { get; set; }
        public string DateTimeFormat { get; set; }
        public int WebServiceTimeout { get; set; }
        public int MaxItemPerPage { get; set; }
        public int MaxItemPerPageSearchAll { get; set; }
        public string CurrencyFormat { get; set; }
        public string DecimalFormat { get; set; }
        public string IntegerFormat { get; set; }
        public int ItemPerSlideShow { get; set; }
        public int AmountOfSlideShow { get; set; }

        public string ImageFolder { get; set; }
    }
}